package com.jgzx.constant.receive;

import cn.hutool.core.util.StrUtil;

/**
 * 应收类型
 * @author chenzy
 * @date 2021/7/19 10:49
 **/
public enum ReceivableBillTypeEnum {
    /** QCYS【期初应收】 */
    OPENING_RECEIVABLE("QCYS", "期初应收"),
    /** QTYS【其它应收】 */
    OTHER_RECEIVABLE("QTYS", "其它应收"),
    /** XSYS【销售应收】 */
    SALE_RECEIVABLE("XSYS", "销售应收"),
    ;
    private final String value;
    private final String showName;

    /**
     * @param value 值
     * @param showName 显示名称
     */
    ReceivableBillTypeEnum(String value, String showName){
        this.value = value;
        this.showName = showName;
    }

    /**
     * 通过单据类型值获取枚举对象
     * @param value 单据类别值
     * @return 单据类型枚举
     */
    public static ReceivableBillTypeEnum getReceivableBillTypeByValue(String value){
        for(ReceivableBillTypeEnum receivableBillType : ReceivableBillTypeEnum.values()){
            if(StrUtil.equals(value, receivableBillType.value())){
                return receivableBillType;
            }
        }
        return null;
    }

    public String value() {
        return this.value;
    }

    public String showName() {
        return this.showName;
    }
}
